<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Wall_model extends CI_Model
{
	
	public function __construct()
	{
		parent::__construct();
	}
	
	public function get_user_details($id)
	{
		$this->db->select('users.*,users_groups.*');
		$this->db->from('users');
		$this->db->where('users.id = '.$id);
		$this->db->join('users_groups','users.id = users_groups.user_id');
		return $this->db->get()->row_array();
	}
	public function edit_profile($update_values){
		$this->db->update('users',$update_values,array('id'=>$this->session->userdata('user_id')));
	}
	
	public function get_job_details()
	{
		// changing this 
		$this->db->select('users_groups.user_id,groups.name as groupname,department.name as dep_name,user_type.name as usr_name');
		$this->db->from('users_groups');		
		$this->db->join('groups','users_groups.user_id=groups.id');
		$this->db->join('department','users_groups.user_id = department.id');
		$this->db->join('user_type','users_groups.user_id = user_type.id');
		$this->db->where('user_id',$this->session->userdata('user_id'));
		//$this->db->get();
	//	echo  $this->db->last_query();
		return $this->db->get()->row_array();
	}
	
	public function do_upload($id,$file_name)
	{
	$this->db->update('users',array('profile_image'=>$file_name),array('id'=>$id));	
	}
	

	
}
